package com.ext.aic.fragment;

import android.os.Bundle;
import android.view.View;

import com.ext.aic.handler.FormValidatorHandler;
import com.mobsandgeeks.saripaar.ValidationError;
import com.mobsandgeeks.saripaar.Validator;

import java.util.List;

public class BaseFormFragment extends BaseFragment implements Validator.ValidationListener {

    protected FormValidatorHandler validatorHandler = new FormValidatorHandler();

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        validatorHandler.bindFormValidator(this);
    }

    @Override
    public void onValidationSucceeded() {

    }

    @Override
    public void onValidationFailed(List<ValidationError> errors) {
        validatorHandler.onValidationFailed(errors, getContext());
    }
}
